/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javase - T19
 * <p>Powered by webrx On 2021-12-27 14:39:14
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class T19 {

    void work() {
        String tn = Thread.currentThread().getName();
        for (int i = 0; i < 15; i++) {
            System.out.println(tn + ":" + i);
            //synchronized (this) {
            if (i >= 5) {
                Thread.yield();
            }
            //}
        }
    }

    public static void main(String[] args) {
        var t = new T19();
        new Thread(t::work, "张三").start();
        new Thread(t::work, "李四").start();
    }
}
